﻿using System;
using Zinnia.Caching;

namespace Zinnia.Services
{
    /// <summary>
    /// 缓存时钟接口
    /// </summary>
    public interface IClock : IVolatileProvider
    {
        /// <summary>
        /// 当前时间
        /// </summary>
        DateTime UtcNow { get; }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="duration"></param>
        /// <returns></returns>
        IVolatileToken When(TimeSpan duration);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="absoluteUtc"></param>
        /// <returns></returns>
        IVolatileToken WhenUtc(DateTime absoluteUtc);
    }
}
